package cn.zjk.springframework.beans;

import java.util.ArrayList;
import java.util.List;

/**
 * @author zjk
 * @CreateTime 2023/3/20 21:49
 */
public class PropertyValues {
    private final List<PropertyValue> propertyValueList = new ArrayList<>();

    public PropertyValue[] getPropertyValues(){
        return this.propertyValueList.toArray(new PropertyValue[0]);
    }

    public void addPropertyValue(PropertyValue propertyValue){
        propertyValueList.add(propertyValue);
    }

    public PropertyValue getPropertyValue(String propertyName){
        for(PropertyValue propertyValue:propertyValueList){
            if(propertyValue.getName().equals(propertyName)){
                return propertyValue;
            }
        }
        return null;
    }
}
